<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <link rel="icon" type="image/svg+xml" href="/vite.svg"/>
    <meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
    <meta http-equiv="Pragma" content="no-cache"/>
    <meta http-equiv="Expires" content="0"/>
    <title>题目</title>
    <style>
        #app{
            margin-top: 5vh;
            margin-top: calc(constant(safe-area-inset-top) + 5vh);
            margin-top: calc(env(safe-area-inset-top) + 5vh);
        }
        .van-notify{
            margin-top: 5vh;
            margin-top: calc(constant(safe-area-inset-top) + 5vh);
            margin-top: calc(env(safe-area-inset-top) + 5vh);
        }
    </style>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
<script>
    // 水滴屏适配
/*    function getSafeArea() {
        const safeArea = {
            top: parseInt(getComputedStyle(document.documentElement).getPropertyValue('env(safe-area-inset-top)')) || 1,
            bottom: parseInt(getComputedStyle(document.documentElement).getPropertyValue('env(safe-area-inset-bottom)')) || 1,
            left: parseInt(getComputedStyle(document.documentElement).getPropertyValue('env(safe-area-inset-left)')) || 1,
            right: parseInt(getComputedStyle(document.documentElement).getPropertyValue('env(safe-area-inset-right)')) || 1
        };

        return safeArea;
    }

    function adjustLayout() {
        const safeArea = getSafeArea();
        console.log("高度",safeArea.top)
        const layoutElement = document.getElementById('app');
        layoutElement.style.paddingTop = `${safeArea.top}px`;
/!*        layoutElement.style.paddingBottom = `${safeArea.bottom}px`;
        layoutElement.style.paddingLeft = `${safeArea.left}px`;
        layoutElement.style.paddingRight = `${safeArea.right}px`;*!/
    }
    adjustLayout();*/

    document.addEventListener('plusready', function () {
        var webview = plus.webview.currentWebview();
        plus.key.addEventListener('backbutton', function () {
            webview.canBack(function (e) {
                if (e.canBack) {
                    webview.back();
                } else {
                    //首页返回键处理
                    //处理逻辑：1秒内，连续两次按返回键，则退出应用；
                    var first = null;
                    plus.key.addEventListener('backbutton', function () {
                        //首次按键，提示‘再按一次退出应用’
                        if (!first) {
                            first = new Date().getTime();
                           // vant.Toast('再次点击退出', 1000);
                            setTimeout(function () {
                                first = null;
                            }, 1000);
                        } else {
                            if (new Date().getTime() - first < 1500) {
                                plus.runtime.quit();
                            }
                        }
                    }, false);
                }
            })
        });
    });
</script>
</html>
